{js:my97date}
<article class="module width_full">
	<header style="height:300px;">
		<h3 class="tabs_involved" style="width:100%">订单列表</h3>
		<ul class="tabs" style="float:none;">
			<li>
				<form action="{url:/}" method="get" name="filterForm">
					<input type='hidden' name='controller' value='seller' />
					<input type='hidden' name='action' value='order_list' />
				<label>订单号</label>
				<input name="search[order_no]" value="" type="text" />

				<label>收货人</label>
				<input name="search[accept_name]" value="" type="text" />

				<label>选择支付状态</label>
				<select name="search[pay_status]">
					<option value="">全部</option>
					<option value="0">未支付</option>
					<option value="1">已支付</option>
					<option value="2">退款成功</option>
				</select>

				<label>选择发货状态</label>
				<select name="search[distribution_status]">
					<option value="">全部</option>
					<option value="0">未发货</option>
					<option value="1">已发货</option>
					<option value="2">部分发货</option>
				</select>

				<label>订单状态</label>
				<select name="search[status]">
					<option value="">全部</option>
					<option value="1">新订单</option>
					<option value="2">确认订单</option>
					<option value="3">取消订单</option>
					<option value="4">作废订单</option>
					<option value="5">完成订单</option>
				</select>
                <br/>
				<label>订单总额</label>
				<div class="box">
					<input name="search[order_amount_start]" value="" type="text" class="small" /> ——
					<input name="search[order_amount_end]" value="" type="text" class="small" />
				</div>

				<label>下单时间</label>
				<div class="box">
					<input name="search[create_time_start]" value="" type="text" class="small" onfocus="WdatePicker()" /> ——
					<input name="search[create_time_end]" value="" type="text" class="small" onfocus="WdatePicker()" />
				</div>

				<label>发货时间</label>
				<div class="box">
					<input name="search[send_time_start]" value="" type="text" class="small" onfocus="WdatePicker()" /> ——
					<input name="search[send_time_end]" value="" type="text" class="small" onfocus="WdatePicker()" />
				</div>

				<label>完成时间</label>
				<div class="box">
					<input name="search[completion_time_start]" value="" type="text" class="small" onfocus="WdatePicker()" /> ——
					<input name="search[completion_time_end]" value="" type="text" class="small" onfocus="WdatePicker()" />
				</div>
				</form>
			</li>
			<li><input type="button" class="alt_btn  aui_state_highlight aui_buttons"   value="检索" /></li>
			<li><input type="button" class="alt_btn" onclick="window.open('{url:/seller/order_report/?$searchParam}')" value="导出Excel" /></li>
		</ul>
	</header>

	<table class="tablesorter" cellspacing="0">
		<colgroup>
			<col width="145px" />
			<col width="85px" />
			<col width="115px" />
			<col width="125px" />
			<col width="125px" />
			<col width="155px" />
			<col width="75px" />
			<col />
		</colgroup>

		<thead>
			<tr>
				<th>订单号</th>
				<th>收货人</th>
				<th>联系电话</th>
				<th>收货地址</th>
				<th>配送状态</th>
				<th>支付状态</th>
				<th>下单时间</th>
				<th>打印</th>
				<th>操作</th>
				<th>快递公司选择</th>
				<th>订单号填写</th>
				<th>快递操作</th>
			</tr>
		</thead>

		<tbody>
			{foreach:items = $this->orderHandle->find()}
			<tr>
				<td title="{$item['order_no']}" name="orderStatusColor{$item['status']}">{$item['order_no']}</td>
				<td title="{$item['accept_name']}">{$item['accept_name']}</td>
				<td title="{$item['mobile']}">{$item['mobile']}</td>
				<td title="{$item['mobile']}">{echo:join('&nbsp;',area::name($item['province'],$item['city'],$item['area']))}{$item['address']}</td>
				<td name="disStatusColor{$item['distribution_status']}">{echo:Order_class::getOrderDistributionStatusText($item)}</span></td>
				<td name="payStatusColor{$item['pay_status']}">
					{if:$item['pay_type']==0}货到付款{/if}
					&nbsp;&nbsp;
					{echo:Order_class::getOrderPayStatusText($item)}
				</td>
				<td title="{$item['create_time']}">{$item['create_time']}</td>
				<td>
					<span class="prt" title="购物清单打印" onclick="window.open('{url:/order/shop_template/id/$item[id]/seller_id/$seller_id}');">购</span>
					<span class="prt" title="配货单打印" onclick="window.open('{url:/order/pick_template/id/$item[id]/seller_id/$seller_id}');">配</span>
					<span class="prt" title="联合打印" onclick="window.open('{url:/order/merge_template/id/$item[id]/seller_id/$seller_id}');">合</span>
					<span class="prt" title="快递单打印" onclick="window.open('{url:/order/expresswaybill_template/id/$item[id]/seller_id/$seller_id}');">递</span>
				</td>
				<td>
					<a href="{if:Order_class::isGoDelivery($item)}{url:/seller/order_deliver/id/$item[id]}{else:}javascript:alert('订单不满足发货条件');{/if}"><img class="operator" src="{skin:images/main/icn_jump_back.png}" title="立即发货" alt="立即发货" /></a>
					<a href="{url:/seller/order_show/id/$item[id]}"><img title="订单详情" alt="订单详情" src="{skin:images/main/icn_settings.png}" /></a>
				</td>
				<td>

					{if:$status=$item['pay_status']==1 and $item['distribution_status']==0}
					     {set:$status=1}
					{else:}
					     {set:$status=0}
					{/if}
					{if:$status}
					<select name="freight_id" pattern="required" alt="物流公司">
					    <option value="0">物流公司</option>
						{set:$id=$item['id']}
						{query:name=freight_company where=is_del eq 0 as=aa}
						<option value="{$item['id']}">{$item['freight_name']}</option>
						{/query}
					</select>
					{/if}
				</td>
				<td>{if:$status}<input type="text" class="normal" name="delivery_code" pattern="required" />{/if}</td>
				<td>{if:$status}<input type="button" class="sub_sf" data-id="{$id}" value="提交物流操作"/>{/if}</td>
			</tr>
		   {/foreach}
		</tbody>
	</table>
	{$this->orderHandle->getPageBar()}
</article>

<script type="text/html" id="orderTemplate">
<form action="{url:/}" method="get" name="filterForm">
	<input type='hidden' name='controller' value='seller' />
	<input type='hidden' name='action' value='order_list' />
	<div class="module_content">

    </div>
</form>
</script>
<script type='text/javascript'>

//检索商品
function filterResult()
{
	var ordersHeadHtml = template.render('orderTemplate');
	art.dialog(
	{
		"init":function()
		{
			var filterPost = {echo:JSON::encode(IReq::get('search'))};
			var formObj = new Form('filterForm');
			for(var index in filterPost)
			{
				formObj.setValue("search["+index+"]",filterPost[index]);
			}
		},
		"title":"检索条件",
		"content":ordersHeadHtml,
		"okVal":"立即检索",
		"ok":function(iframeWin, topWin)
		{
			iframeWin.document.forms[0].submit();
		}
	});
}

//DOM加载结束
$(function(){
	//高亮色彩
	$('[name="payStatusColor1"]').addClass('green');
	$('[name="disStatusColor1"]').addClass('green');
	$('[name="orderStatusColor3"]').addClass('red');
	$('[name="orderStatusColor4"]').addClass('red');
	$('[name="orderStatusColor5"]').addClass('green');
});
	$(".aui_state_highlight").click(function(){
		$("form[name='filterForm']").submit();
	});
	$(document).ready(function(){
		//初始化筛选条件
		var filterPost = {echo:JSON::encode(IReq::get('search'))};
		var formObj = new Form('filterForm');
		for(var index in filterPost)
		{
			formObj.setValue("search["+index+"]",filterPost[index]);
		}
		$(".sub_sf").click(function(){

			var id=$(this).attr('data-id');
			var paobj=$(this).parent().parent();
			var freight_id=paobj.find("select[name='freight_id']").val();
			var delivery_code=paobj.find("input[name='delivery_code']").val();
			console.log(freight_id);
			if(freight_id==0){
				alert('请选择快递公司');
			}
			if(delivery_code==''){
				alert('请填写物流单号');
			}
			var get_url="{url:/seller/get_order_deliver}";
			//获取当前订单参数信息
			$.get(get_url,{id:id},function(return_data){
				return_data=eval("("+return_data+")");
                if(return_data['isError']==0){
                	data=return_data['data'];
					var url="{url:/order/order_delivery_doc}";
					data['freight_id']=freight_id;
					data['delivery_code']=delivery_code;
					$.post(url,data,function(result){
						console.log('result');
					});
				}else{
					alert(return_data['message']);
				}

			});
		});
	});

</script>